#ifndef _UI_DRAGWIDGET_H_
#define _UI_DRAGWIDGET_H_

#include "ui/ui_widget.h"

namespace ui
{

class UIDragWidget : public UIWidget
{
public:
	UIDragWidget(UIWidget* pParent, const std::string& Name = "");
	virtual ~UIDragWidget();

	/// load from table
	virtual	bool		Load(LuaPlus::LuaObject& _LObj);
	/// update
	virtual	bool		Tick(float dt);
	/// display
	virtual bool		Render(bool Force = false);
	/// mouse event
	virtual bool		OnMousePress(const math::Vec2& Pos, unsigned int Button);
	/// register with LUA Bind
	static	void		Register(LuaPlus::LuaState* _pScript);

	virtual UIWidget*	GetClone();

	// drag widget specifics
	const std::string&	GetStartDragScript()							{ return m_StartDragScript; }
	void				SetStartDragScript(const std::string& script)	{ m_StartDragScript = script; }
	const std::string&	GetEndDragScript()								{ return m_EndDragScript; }
	void				SetEndDragScript(const std::string& script)		{ m_EndDragScript = script; }
	bool				DoNotPushToFront() const						{ return m_DoNotPushToFront; }
	void				SetPushToFront(bool b)							{ m_DoNotPushToFront = b; }

protected:
	/// export widget specifics to file
	virtual bool		ExportSpecificsToFile(script::WriteLua*	pWL);

	ui::UIWidget*		m_pParentPanel;
	ui::UIWidget*		m_pDragParent;

	std::string			m_StartDragScript;
	std::string			m_EndDragScript;
	bool				m_DoNotPushToFront;

private:
	bool				m_InitDragData;

	static ui::UIWidget*	s_pDragTarget;
	static math::Vec2		s_DragOffset;
	float					m_StartY;
	bool					m_IsAlreadySetStartY;
	

}; // class UIBipedWidget

}  // namespace ui

#endif //_UI_DRAGWIDGET_H_
